//
//  WLFileRequest.h
//  WanLian
//
//  Created by 123456 on 2019/1/4.
//  Copyright © 2019 wanlian. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BGFMDB.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, WLWorkingState) {
    WLWorkingStateReadySend = 0,
    WLWorkingStateSending,
    WLWorkingStateSuspend,
    WLWorkingStateCanceal,
    WLWorkingStateReSend,
    WLWorkingStateFail//断点，从内存独处来
};
@interface WLFileRequestConfig : NSObject
/* 是否保存的本地相册 */
@property (nonatomic, assign) BOOL saveToAbulm;
@end
@interface WLFileRequest : NSObject
@property (nonatomic, assign) NSTimeInterval timeOut;
@property (nonatomic, strong) NSURL *fileURL;
@property (nonatomic, strong) NSString *reqeustURL;
@property (nonatomic, strong) NSURL *mediaLocalURL;
@property (nonatomic, copy) NSString *host;
@property (nonatomic, assign) long port;
@property (nonatomic, copy) NSString *fileName;
@property (nonatomic, assign) long fileTotalBytes;
@property (nonatomic, strong) NSMutableArray *blockModelArr;
@property (nonatomic, strong) NSMutableArray *blockWorkArr;
@property (nonatomic, assign) WLWorkingState workingState;
@property (nonatomic, assign) long currentSize;
@property (nonatomic, assign) BOOL bContinue;
@property (nonatomic, assign) long offset;
@property (nonatomic, assign) long blockSize;
@property (nonatomic, assign) int blockCount;
@property (nonatomic, assign) long p_last_bs;
/** 0 视频 1照片 2音频 */
@property (nonatomic, assign) int fileType;

@property (nonatomic, strong) WLFileRequestConfig *requestConfig;
- (NSString *)fileInfoDict;
- (NSString *)fileInfoDictWithBlockIndex:(NSInteger)index;
- (void)fonfigBlockInfo;
- (NSData *)getTransmitDataWithSendData:(NSData *)sendData blockIndex:(NSInteger)index;

- (NSData *)getFileTransmitHeadDataWithType:(NSString *)type;
@end

NS_ASSUME_NONNULL_END
